package cn.edu.fzu.delivery.domain.enums;

/**
 * 性别枚举
 *
 * @author fangxin
 * @date 2022/11/2
 */
public enum SexEnum implements SpringConvertibleEnum{

    SECRET(-1, "保密"),
    MALE(0, "男"),
    FEMALE(1, "女"),
    OTHER(2, "其他");

    //值
    private final int    value;

    //描述
    private final String desc;

    private SexEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }


    public int getValue() {
        return value;
    }


    public String getDesc() {
        return desc;
    }


    public static SexEnum parse(int value) {
        switch (value) {
            case -1:
                return SECRET;
            case 0:
                return MALE;
            case 1:
                return FEMALE;
            default:
                return OTHER;
        }
    }


    @Override
    public String toString() {
        return String.valueOf(getValue());
    }
}
